home *** CD-ROM | disk | FTP | other *** search
- { MastApp Main Window.
-
- By default, the database component's alias is DBDEMOS, and so the
- application accesses the Paradox tables. To upsize the application
- to Local Interbase Server, take the following steps:
-
- 1 Pull down the Tools menu, launch Database Desktop and select its
- File|Aliases... to create a new alias. Press the NEW button and name
- the alias MASTSQL. Set the alias type to INTRBASE and specify a server
- name of C:\DELPHI\DEMOS\DATA\MASTSQL.GDB. Set the user name to SYSDBA
- and then press KEEP NEW.
-
- 2 Enter the password "masterkey" (it MUST be entered in lowercase) and
- press CONNECT in order to validate the alias you have just created.
- (If you cannot connect, make sure the IBLOCAL bin directory is on your
- DOS path and you specified the correct location for the MASTSQL.GDB
- file. If you still cannot connect, refer to INSTALL.TXT and README.TXT
- for more information.)
-
- Press DISCONNECT, OK and then answer YES when asked whether to save
- these changes in your configuration file.
-
- 3 Close the Database Desktop and return to Delphi. Close the project (in
- order to close all open forms) then and re-open it by selecting
- MASTAPP.DPR from the pick list at the bottom of the File menu.
- Select the database component in the lower left corner of the MainForm
- and set its Connected property to False. Click on the AliasName property's
- dropdown list and select MASTSQL. (If MASTSQL is not listed, go back to
- the Database Desktop and make sure you can connect from there). Finally,
- set the Database component's Connected property to True, enter the
- password ("masterkey") and run.
-
- You've just "upsized" MASTAPP to a client-server application! To switch
- between the desktop and SQL versions, close all units and forms (the easiest
- way is to close and re-open the project as instructed above), use the
- Object Inspector to set MainForm.Database's Connected property to False, pick
- an AliasName (DBDEMOS to use the Paradox database, MASTSQL to use
- the Local InterBase Server version), and set Connected to True.
- Now you're ready to run.
- }
-
- unit Main;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, Buttons, StdCtrls, Menus, ExtCtrls, DB;
-
- type
- TMainForm = class(TForm)
- MainPanel: TPanel;
- OrderBtn: TSpeedButton;
- BrowseBtn: TSpeedButton;
- PartsBtn: TSpeedButton;
- CloseBtn: TSpeedButton;
- Database: TDatabase;
- MainMenu1: TMainMenu;
- File1: TMenuItem;
- PrinterSetup1: TMenuItem;
- N3: TMenuItem;
- N4: TMenuItem;
- NewOrder2: TMenuItem;
- N5: TMenuItem;
- View1: TMenuItem;
- Orders1: TMenuItem;
- PartsInventiry1: TMenuItem;
- Help1: TMenuItem;
- About1: TMenuItem;
- N7: TMenuItem;
- StayOnTop2: TMenuItem;
- HelpBtn: TSpeedButton;
- N6: TMenuItem;
- Contents1: TMenuItem;
- PrinterSetup: TPrinterSetupDialog;
- procedure BrowseCustOrd(Sender: TObject);
- procedure CloseApp(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure BrowseParts(Sender: TObject);
- procedure ToggleStayonTop(Sender: TObject);
- procedure NewOrder(Sender: TObject);
- procedure HelpBtnClick(Sender: TObject);
- procedure PrinterSetupClick(Sender: TObject);
- procedure AboutClick(Sender: TObject);
- procedure FormDestroy(Sender: TObject);
-
- private
- end;
-
- var
- MainForm: TMainForm;
-
- implementation
-
- uses CustOrd, BrParts, EdOrders, About, Custqry, IniFiles;
-
- {$R *.DFM}
-
- procedure TMainForm.BrowseCustOrd(Sender: TObject);
- begin
- BrCustOrdForm.Show;
- end;
-
- procedure TMainForm.CloseApp(Sender: TObject);
- begin
- Close;
- end;
-
- procedure TMainForm.FormCreate(Sender: TObject);
- var W: longint;
- begin
- ClientWidth := CloseBtn.Left + CloseBtn.Width - 1;
- ClientHeight := CloseBtn.Top + CloseBtn.Height - 1;
- MainPanel.Align := alClient;
- { position the form at the top of display }
- Left := 0;
- Top := 0;
- end;
-
- procedure TMainForm.BrowseParts(Sender: TObject);
- begin
- BrPartsForm.Show;
- end;
-
-
- procedure TMainForm.ToggleStayonTop(Sender: TObject);
- begin
- with Sender as TMenuItem do
- begin
- Checked := not Checked;
- if Checked then MainForm.FormStyle := fsStayOnTop
- else MainForm.FormStyle := fsNormal;
- end;
- end;
-
- procedure TMainForm.NewOrder(Sender: TObject);
- begin
- OrderForm.Enter;
- ClientHeight := CloseBtn.Height - 1;
- end;
-
- procedure TMainForm.HelpBtnClick(Sender: TObject);
- begin
- Application.HelpCommand(HELP_CONTENTS,0);
- end;
-
- procedure TMainForm.PrinterSetupClick(Sender: TObject);
- begin
- PrinterSetup.Execute;
- end;
-
- procedure TMainForm.AboutClick(Sender: TObject);
- begin
- AboutBox.ShowModal;
- end;
-
- procedure TMainForm.FormDestroy(Sender: TObject);
- begin
- Application.HelpCommand(HELP_QUIT,0);
- end;
-
- end.
-